/*
 * @Date: 2023-03-10 18:43:50
 * @LastEditors: Zireael 1193875164@qq.com
 * @LastEditTime: 2023-03-23 14:58:48
 * @FilePath: \A19\backend\src\api\QuestionsSys\ApiJudgeTest.ts
 */
import { ApiCall } from "tsrpc";
import { ReqJudgeTest, ResJudgeTest } from "../../shared/protocols/QuestionsSys/PtlJudgeTest";
import { Global } from '../../Global/index';

export default async function (call: ApiCall<ReqJudgeTest, ResJudgeTest>) {
    // TODO
    const { score,useTest,answers,examOrHomework } = call.req

    console.log(useTest);

    const ret = await Global.collection(examOrHomework === 'exam'?'userTests':'userHomework').updateOne({
        _id:useTest,
    },{
        $set:{
            score,
            answers
        }
    })

    call.succ({})
}